#include<stdio.h>
#include<math.h>

int Ackerman(int m,int n);
int main(void)
{
	int m,n;
	scanf("%d %d",&m,&n);
	printf("%d",Ackerman(m,n));
	return 0;
}

int Ackerman(int m,int n)
{
	if(m==0)
	{
		return n+1;
	}
	if(n==0)
	{
		return Ackerman(m-1,1);
	}
	if(n>0&&m>0)
	{
		return Ackerman(m-1,Ackerman(m,n-1));
	}
}
